package com.xxzb.pack0722;

import com.xxzb.bean.Dept;
import com.xxzb.bean.Emp;
import com.xxzb.pack0722.拼接.EmpDAO;
import com.xxzb.pack0722.组装.service.DeptService;
import com.xxzb.pack0722.组装.service.EmpService;

import java.util.ArrayList;
import java.util.List;




public class App {
    public static void main(String[] args) {
//a();
//b();
       c();
    }

    private static void a() {
        EmpService empService=new EmpService();
        List<Emp> list=empService.find();
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }
    private static void b()  {
        DeptService service=new DeptService();
        List<Dept> list= null;
        try {
            list = service.find();
        } catch (Exception e) {
            e.printStackTrace();
        }
        for (int i = 0; i < list.size(); i++) {
            Dept dept= list.get(i);
            System.out.println(dept.getDeptNo()+"\t"+dept.getDname()+"\t"+dept.getLoc());
            List<Emp> emps=dept.getEmps();
            for (int j = 0; j < emps.size(); j++) {
                System.out.println("\t"+emps.get(j));
            }

        }

    }
    private static void c(){
        EmpDAO empDAO=new EmpDAO();
        List<Emp> list= null;
        try {
            list = empDAO.find();
        } catch (Exception e) {
            e.printStackTrace();
        }
        for (Emp emp:list) {
            System.out.println(emp);
        }
    }
}
